package com.fxu.gen.enums;

import com.fxu.framework.core.enums.BaseEnum;
import lombok.AllArgsConstructor;

/**
 * 索引类型
 */
@AllArgsConstructor
public enum IndexType implements BaseEnum {
    PRIMARY_KEY(1, "PRIMARY KEY"),
    UNIQUE_KEY(2, "UNIQUE KEY"),
    KEY(3, "KEY"),
    ;

    int code;
    String desc;

    @Override
    public Integer code() {
        return code;
    }
    @Override
    public String desc() {
        return desc;
    }

    public static IndexType find(Integer code) {
        return code == null ? null : BaseEnum.findOne(IndexType.values(), v -> code.equals(v.code));
    }
}